package flow

// Slashable represents an message we got from a different node, whose validity has not been _entirely_
// confirmed. We want to retain information about the origin that published this particular message
// within the network, so we can potentially raise a slashing challenge against the origin, should
// we discover that this message is evidence of a protocol violation.
// TODO: this struct does not have its final form. We only retain the ID of the node where the message
// originated. However, this will not allow us to prove to somebody else that `OriginID` really sent
// this message, as we could have tempered with the message and then erroneously accuse `OriginID`
// of a protocol violation. In the mature protocol, `OriginID` will be replaced by an inspector object
// (generated by the networking layer) that allows us to generate a cryptographic proof of who sent the message.
type Slashable[T any] struct {
	OriginID Identifier // this will become the inspector object, once we have message forensics
	Message  T
}

// NoSlashable returns the zero value for Slashable[T].
func NoSlashable[T any]() Slashable[T] {
	return Slashable[T]{}
}
